#ifndef CWIDGET_H
#define CWIDGET_H

#include <QWidget>
#include <QEvent>
#include <QKeyEvent>

class CWidget : public QWidget
{
    Q_OBJECT
public:
    explicit CWidget(QWidget *parent = 0):QWidget(parent){;}

signals:

public slots:

protected:
    bool event(QEvent *e);
};

inline bool CWidget::event(QEvent *e)
{
    if (QEvent::KeyPress == e->type()) {
        QKeyEvent *keyEvent = static_cast<QKeyEvent *>(e);
        if (Qt::Key_Tab == keyEvent->key()) {
            qDebug("You press tab.");
            return true;
        }
    }

    return QWidget::event(e);
}
#endif // CWIDGET_H
